package com.ithemai.work;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * @auther Macrydy
 * @date 2020/7/4 18:54
 * 5.1 题目一: 根据考试的答案,和学生提交的答题卡来判断该学员的分数.(一道10分)一共10道题.
 * 考试答案:   daan.txt
 * 1.A
 * 2.C
 * 3.D
 * 4.B
 * 学员答题卡:   stu.txt-.
 * 1.B
 * 2.C
 * 3.C
 * 4.B
 */
public class Test8 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new FileReader("daan.txt"));
        BufferedReader br1 = new BufferedReader(new FileReader("stu.txt"));

        int score=0;
        List<String> daan = method(br);
        List<String> stu = method(br1);
        for (int i = 0; i < daan.size(); i++) {
            if (daan.get(i).equals(stu.get(i))){
                score+=10;
            }
        }
        System.out.println(score);
    }

    private static List<String> method(BufferedReader br) throws IOException {
        List<String> list=new ArrayList<>();
        String line;
        while ((line = br.readLine())!=null){
            String[] split = line.split("\\.");
            list.add(split[1]);
        }
        br.close();
        return list;

    }
}
